home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_01_04
/
1n04039a
< prev
next >
Wrap
Text File
|
1990-07-23
|
385b
|
36 lines
Listing 2
#include <ctype.h>
typedef int bool;
#define FALSE 0
#define TRUE 1
int atoi(const char *s)
{
int n = 0;
bool neg = FALSE;
while (isspace(*s))
++s;
if (*s == '+')
++s;
else if (*s == '-')
{
neg = TRUE;
++s;
}
while (isdigit(*s))
{
n = 10 * n + *s - '0';
++s;
}
if (neg)
n = -n;
return n;
}
----------